﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace DoNetTool.Common
{
    public class JsonReturn
    {
        public int RetCode { get; set; }  //0--操作失败   1--操作成功
        public int ErrCode { get; set; }
        public string ErrDesc { get; set; }
        public object RetData { get; set; }

        private void Ini()
        {
            ErrCode = 0;
            RetCode = 0;
            ErrDesc = string.Empty;
            RetData = null;
        }
        public JsonReturn()
        {
            Ini();
            RetCode = 1;
        }

        public JsonReturn(int eCode,string eDesc)
        {
            SetErr(eCode, eDesc);

        }

        public JsonReturn(object oData)
        {
            Ini();
            RetCode = 1;
            RetData = oData;

        }

        public JsonReturn SetErr(int eCode, string eDesc)
        {
            Ini();
            ErrCode = eCode;
            ErrDesc = eDesc;
            return this;
        }

    }
}
